package com.SpringMVC.Format;

import com.SpringMVC.vo.User;
import org.springframework.format.Formatter;

import java.text.ParseException;
import java.util.Locale;

/**
 * Created by mike on 17/5/21.
 */
public class TestFormat implements Formatter<User> {
    @Override
    public User parse(String s, Locale locale) throws ParseException {
        User user = new User();
        user.setId(3333);
        user.setUsername("formatter");
        return user;
    }

    @Override
    public String print(User user, Locale locale) {
        return (user.getId()+user.getUsername());
    }
}
